package sandbox.vaadin.skiller.entity;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import sandbox.dao.AbstractDAOJPA;

@Stateless
public class SkillgroupDAOSSB extends AbstractDAOJPA<Skillgroup, Long>
{
	public SkillgroupDAOSSB()
	{
		super(Skillgroup.class);
	}

	@PersistenceContext
	private EntityManager entityManager;

	@Override
	public EntityManager getEntityManager()
	{
		return entityManager;
	}

	public int deleteAll()
	{
		Query query = entityManager.createNamedQuery("Skillgroup_delete_all");
		return query.executeUpdate();
	}

	public void populate()
	{
		Populator populator = new Populator(entityManager);
		populator.populate();
	}

	public void unpopulate()
	{
		UnPopulator unpopulator = new UnPopulator(entityManager);
		unpopulator.unpopulate();
	}
}